package com.hfy.admin.mapper;

import com.hfy.model.po.draft.DraftMusicPo;
import org.apache.ibatis.annotations.*;

import java.util.List;

/**
 * @ author 韩
 * time: 2024/7/16 1:51
 */
@Mapper
public interface DraftMapper {
    @Insert("INSERT INTO `music_draft` (`account`, `music_url`) VALUES (#{account}, #{musicURL})")
    void insertDraftRecord(@Param("musicURL") String musicURL,@Param("account") Long account);

    @Select("SELECT id,`music_url`, `music_length` AS musicUrl, '' AS `name` FROM `music_draft` WHERE `account` = #{account} AND `is_die` = 0")
    List<DraftMusicPo> getInfoByAccount(@Param("account") Long account);

    @Update("UPDATE `music_draft` SET is_die = 1 WHERE id = #{id}")
    void delDraftMusic(@Param("id") Long id);

    @Update("UPDATE `music_draft` SET is_die = 1 WHERE account = #{id}")
    void delDraftMusicList(@Param("account") Long account);

}
